//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS Schemas service.
///
/// Amazon EventBridge Schema Registry
public struct Schemas: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the Schemas client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            serviceName: "Schemas",
            serviceIdentifier: "schemas",
            serviceProtocol: .restjson,
            apiVersion: "2019-12-02",
            endpoint: endpoint,
            errorType: SchemasErrorType.self,
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }





    // MARK: API Calls

    /// Creates a discoverer.
    @Sendable
    @inlinable
    public func createDiscoverer(_ input: CreateDiscovererRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateDiscovererResponse {
        try await self.client.execute(
            operation: "CreateDiscoverer", 
            path: "/v1/discoverers", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a discoverer.
    ///
    /// Parameters:
    ///   - crossAccount: Support discovery of schemas in events sent to the bus from another account. (default: true).
    ///   - description: A description for the discoverer.
    ///   - sourceArn: The ARN of the event bus.
    ///   - tags: Tags associated with the resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func createDiscoverer(
        crossAccount: Bool? = nil,
        description: String? = nil,
        sourceArn: String? = nil,
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateDiscovererResponse {
        let input = CreateDiscovererRequest(
            crossAccount: crossAccount, 
            description: description, 
            sourceArn: sourceArn, 
            tags: tags
        )
        return try await self.createDiscoverer(input, logger: logger)
    }

    /// Creates a registry.
    @Sendable
    @inlinable
    public func createRegistry(_ input: CreateRegistryRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateRegistryResponse {
        try await self.client.execute(
            operation: "CreateRegistry", 
            path: "/v1/registries/name/{RegistryName}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a registry.
    ///
    /// Parameters:
    ///   - description: A description of the registry to be created.
    ///   - registryName: The name of the registry.
    ///   - tags: Tags to associate with the registry.
    ///   - logger: Logger use during operation
    @inlinable
    public func createRegistry(
        description: String? = nil,
        registryName: String,
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateRegistryResponse {
        let input = CreateRegistryRequest(
            description: description, 
            registryName: registryName, 
            tags: tags
        )
        return try await self.createRegistry(input, logger: logger)
    }

    /// Creates a schema definition. Inactive schemas will be deleted after two years.
    @Sendable
    @inlinable
    public func createSchema(_ input: CreateSchemaRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateSchemaResponse {
        try await self.client.execute(
            operation: "CreateSchema", 
            path: "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a schema definition. Inactive schemas will be deleted after two years.
    ///
    /// Parameters:
    ///   - content: The source of the schema definition.
    ///   - description: A description of the schema.
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - tags: Tags associated with the schema.
    ///   - type: The type of schema.
    ///   - logger: Logger use during operation
    @inlinable
    public func createSchema(
        content: String? = nil,
        description: String? = nil,
        registryName: String,
        schemaName: String,
        tags: [String: String]? = nil,
        type: `Type`? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateSchemaResponse {
        let input = CreateSchemaRequest(
            content: content, 
            description: description, 
            registryName: registryName, 
            schemaName: schemaName, 
            tags: tags, 
            type: type
        )
        return try await self.createSchema(input, logger: logger)
    }

    /// Deletes a discoverer.
    @Sendable
    @inlinable
    public func deleteDiscoverer(_ input: DeleteDiscovererRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "DeleteDiscoverer", 
            path: "/v1/discoverers/id/{DiscovererId}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes a discoverer.
    ///
    /// Parameters:
    ///   - discovererId: The ID of the discoverer.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteDiscoverer(
        discovererId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DeleteDiscovererRequest(
            discovererId: discovererId
        )
        return try await self.deleteDiscoverer(input, logger: logger)
    }

    /// Deletes a Registry.
    @Sendable
    @inlinable
    public func deleteRegistry(_ input: DeleteRegistryRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "DeleteRegistry", 
            path: "/v1/registries/name/{RegistryName}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes a Registry.
    ///
    /// Parameters:
    ///   - registryName: The name of the registry.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteRegistry(
        registryName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DeleteRegistryRequest(
            registryName: registryName
        )
        return try await self.deleteRegistry(input, logger: logger)
    }

    /// Delete the resource-based policy attached to the specified registry.
    @Sendable
    @inlinable
    public func deleteResourcePolicy(_ input: DeleteResourcePolicyRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "DeleteResourcePolicy", 
            path: "/v1/policy", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Delete the resource-based policy attached to the specified registry.
    ///
    /// Parameters:
    ///   - registryName: The name of the registry.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteResourcePolicy(
        registryName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DeleteResourcePolicyRequest(
            registryName: registryName
        )
        return try await self.deleteResourcePolicy(input, logger: logger)
    }

    /// Delete a schema definition.
    @Sendable
    @inlinable
    public func deleteSchema(_ input: DeleteSchemaRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "DeleteSchema", 
            path: "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Delete a schema definition.
    ///
    /// Parameters:
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteSchema(
        registryName: String,
        schemaName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DeleteSchemaRequest(
            registryName: registryName, 
            schemaName: schemaName
        )
        return try await self.deleteSchema(input, logger: logger)
    }

    /// Delete the schema version definition
    @Sendable
    @inlinable
    public func deleteSchemaVersion(_ input: DeleteSchemaVersionRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "DeleteSchemaVersion", 
            path: "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/version/{SchemaVersion}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Delete the schema version definition
    ///
    /// Parameters:
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - schemaVersion: The version number of the schema
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteSchemaVersion(
        registryName: String,
        schemaName: String,
        schemaVersion: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DeleteSchemaVersionRequest(
            registryName: registryName, 
            schemaName: schemaName, 
            schemaVersion: schemaVersion
        )
        return try await self.deleteSchemaVersion(input, logger: logger)
    }

    /// Describe the code binding URI.
    @Sendable
    @inlinable
    public func describeCodeBinding(_ input: DescribeCodeBindingRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DescribeCodeBindingResponse {
        try await self.client.execute(
            operation: "DescribeCodeBinding", 
            path: "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Describe the code binding URI.
    ///
    /// Parameters:
    ///   - language: The language of the code binding.
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - schemaVersion: Specifying this limits the results to only this schema version.
    ///   - logger: Logger use during operation
    @inlinable
    public func describeCodeBinding(
        language: String,
        registryName: String,
        schemaName: String,
        schemaVersion: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DescribeCodeBindingResponse {
        let input = DescribeCodeBindingRequest(
            language: language, 
            registryName: registryName, 
            schemaName: schemaName, 
            schemaVersion: schemaVersion
        )
        return try await self.describeCodeBinding(input, logger: logger)
    }

    /// Describes the discoverer.
    @Sendable
    @inlinable
    public func describeDiscoverer(_ input: DescribeDiscovererRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DescribeDiscovererResponse {
        try await self.client.execute(
            operation: "DescribeDiscoverer", 
            path: "/v1/discoverers/id/{DiscovererId}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Describes the discoverer.
    ///
    /// Parameters:
    ///   - discovererId: The ID of the discoverer.
    ///   - logger: Logger use during operation
    @inlinable
    public func describeDiscoverer(
        discovererId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DescribeDiscovererResponse {
        let input = DescribeDiscovererRequest(
            discovererId: discovererId
        )
        return try await self.describeDiscoverer(input, logger: logger)
    }

    /// Describes the registry.
    @Sendable
    @inlinable
    public func describeRegistry(_ input: DescribeRegistryRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DescribeRegistryResponse {
        try await self.client.execute(
            operation: "DescribeRegistry", 
            path: "/v1/registries/name/{RegistryName}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Describes the registry.
    ///
    /// Parameters:
    ///   - registryName: The name of the registry.
    ///   - logger: Logger use during operation
    @inlinable
    public func describeRegistry(
        registryName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DescribeRegistryResponse {
        let input = DescribeRegistryRequest(
            registryName: registryName
        )
        return try await self.describeRegistry(input, logger: logger)
    }

    /// Retrieve the schema definition.
    @Sendable
    @inlinable
    public func describeSchema(_ input: DescribeSchemaRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DescribeSchemaResponse {
        try await self.client.execute(
            operation: "DescribeSchema", 
            path: "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieve the schema definition.
    ///
    /// Parameters:
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - schemaVersion: Specifying this limits the results to only this schema version.
    ///   - logger: Logger use during operation
    @inlinable
    public func describeSchema(
        registryName: String,
        schemaName: String,
        schemaVersion: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DescribeSchemaResponse {
        let input = DescribeSchemaRequest(
            registryName: registryName, 
            schemaName: schemaName, 
            schemaVersion: schemaVersion
        )
        return try await self.describeSchema(input, logger: logger)
    }

    @Sendable
    @inlinable
    public func exportSchema(_ input: ExportSchemaRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ExportSchemaResponse {
        try await self.client.execute(
            operation: "ExportSchema", 
            path: "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/export", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    ///
    /// Parameters:
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - schemaVersion: Specifying this limits the results to only this schema version.
    ///   - type: 
    ///   - logger: Logger use during operation
    @inlinable
    public func exportSchema(
        registryName: String,
        schemaName: String,
        schemaVersion: String? = nil,
        type: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ExportSchemaResponse {
        let input = ExportSchemaRequest(
            registryName: registryName, 
            schemaName: schemaName, 
            schemaVersion: schemaVersion, 
            type: type
        )
        return try await self.exportSchema(input, logger: logger)
    }

    /// Get the code binding source URI.
    @Sendable
    @inlinable
    public func getCodeBindingSource(_ input: GetCodeBindingSourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetCodeBindingSourceResponse {
        try await self.client.execute(
            operation: "GetCodeBindingSource", 
            path: "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}/source", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Get the code binding source URI.
    ///
    /// Parameters:
    ///   - language: The language of the code binding.
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - schemaVersion: Specifying this limits the results to only this schema version.
    ///   - logger: Logger use during operation
    @inlinable
    public func getCodeBindingSource(
        language: String,
        registryName: String,
        schemaName: String,
        schemaVersion: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetCodeBindingSourceResponse {
        let input = GetCodeBindingSourceRequest(
            language: language, 
            registryName: registryName, 
            schemaName: schemaName, 
            schemaVersion: schemaVersion
        )
        return try await self.getCodeBindingSource(input, logger: logger)
    }

    /// Get the discovered schema that was generated based on sampled events.
    @Sendable
    @inlinable
    public func getDiscoveredSchema(_ input: GetDiscoveredSchemaRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetDiscoveredSchemaResponse {
        try await self.client.execute(
            operation: "GetDiscoveredSchema", 
            path: "/v1/discover", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Get the discovered schema that was generated based on sampled events.
    ///
    /// Parameters:
    ///   - events: An array of strings where each string is a JSON event. These are the events that were used to generate the schema. The array includes a single type of event and has a maximum size of 10 events.
    ///   - type: The type of event.
    ///   - logger: Logger use during operation
    @inlinable
    public func getDiscoveredSchema(
        events: [String]? = nil,
        type: `Type`? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetDiscoveredSchemaResponse {
        let input = GetDiscoveredSchemaRequest(
            events: events, 
            type: type
        )
        return try await self.getDiscoveredSchema(input, logger: logger)
    }

    /// Retrieves the resource-based policy attached to a given registry.
    @Sendable
    @inlinable
    public func getResourcePolicy(_ input: GetResourcePolicyRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetResourcePolicyResponse {
        try await self.client.execute(
            operation: "GetResourcePolicy", 
            path: "/v1/policy", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves the resource-based policy attached to a given registry.
    ///
    /// Parameters:
    ///   - registryName: The name of the registry.
    ///   - logger: Logger use during operation
    @inlinable
    public func getResourcePolicy(
        registryName: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetResourcePolicyResponse {
        let input = GetResourcePolicyRequest(
            registryName: registryName
        )
        return try await self.getResourcePolicy(input, logger: logger)
    }

    /// List the discoverers.
    @Sendable
    @inlinable
    public func listDiscoverers(_ input: ListDiscoverersRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListDiscoverersResponse {
        try await self.client.execute(
            operation: "ListDiscoverers", 
            path: "/v1/discoverers", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// List the discoverers.
    ///
    /// Parameters:
    ///   - discovererIdPrefix: Specifying this limits the results to only those discoverer IDs that start with the specified prefix.
    ///   - limit: 
    ///   - nextToken: The token that specifies the next page of results to return. To request the first page, leave NextToken empty. The token will expire in 24 hours, and cannot be shared with other accounts.
    ///   - sourceArnPrefix: Specifying this limits the results to only those ARNs that start with the specified prefix.
    ///   - logger: Logger use during operation
    @inlinable
    public func listDiscoverers(
        discovererIdPrefix: String? = nil,
        limit: Int? = nil,
        nextToken: String? = nil,
        sourceArnPrefix: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListDiscoverersResponse {
        let input = ListDiscoverersRequest(
            discovererIdPrefix: discovererIdPrefix, 
            limit: limit, 
            nextToken: nextToken, 
            sourceArnPrefix: sourceArnPrefix
        )
        return try await self.listDiscoverers(input, logger: logger)
    }

    /// List the registries.
    @Sendable
    @inlinable
    public func listRegistries(_ input: ListRegistriesRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListRegistriesResponse {
        try await self.client.execute(
            operation: "ListRegistries", 
            path: "/v1/registries", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// List the registries.
    ///
    /// Parameters:
    ///   - limit: 
    ///   - nextToken: The token that specifies the next page of results to return. To request the first page, leave NextToken empty. The token will expire in 24 hours, and cannot be shared with other accounts.
    ///   - registryNamePrefix: Specifying this limits the results to only those registry names that start with the specified prefix.
    ///   - scope: Can be set to Local or AWS to limit responses to your custom registries, or the ones provided by AWS.
    ///   - logger: Logger use during operation
    @inlinable
    public func listRegistries(
        limit: Int? = nil,
        nextToken: String? = nil,
        registryNamePrefix: String? = nil,
        scope: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListRegistriesResponse {
        let input = ListRegistriesRequest(
            limit: limit, 
            nextToken: nextToken, 
            registryNamePrefix: registryNamePrefix, 
            scope: scope
        )
        return try await self.listRegistries(input, logger: logger)
    }

    /// Provides a list of the schema versions and related information.
    @Sendable
    @inlinable
    public func listSchemaVersions(_ input: ListSchemaVersionsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListSchemaVersionsResponse {
        try await self.client.execute(
            operation: "ListSchemaVersions", 
            path: "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/versions", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Provides a list of the schema versions and related information.
    ///
    /// Parameters:
    ///   - limit: 
    ///   - nextToken: The token that specifies the next page of results to return. To request the first page, leave NextToken empty. The token will expire in 24 hours, and cannot be shared with other accounts.
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - logger: Logger use during operation
    @inlinable
    public func listSchemaVersions(
        limit: Int? = nil,
        nextToken: String? = nil,
        registryName: String,
        schemaName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListSchemaVersionsResponse {
        let input = ListSchemaVersionsRequest(
            limit: limit, 
            nextToken: nextToken, 
            registryName: registryName, 
            schemaName: schemaName
        )
        return try await self.listSchemaVersions(input, logger: logger)
    }

    /// List the schemas.
    @Sendable
    @inlinable
    public func listSchemas(_ input: ListSchemasRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListSchemasResponse {
        try await self.client.execute(
            operation: "ListSchemas", 
            path: "/v1/registries/name/{RegistryName}/schemas", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// List the schemas.
    ///
    /// Parameters:
    ///   - limit: 
    ///   - nextToken: The token that specifies the next page of results to return. To request the first page, leave NextToken empty. The token will expire in 24 hours, and cannot be shared with other accounts.
    ///   - registryName: The name of the registry.
    ///   - schemaNamePrefix: Specifying this limits the results to only those schema names that start with the specified prefix.
    ///   - logger: Logger use during operation
    @inlinable
    public func listSchemas(
        limit: Int? = nil,
        nextToken: String? = nil,
        registryName: String,
        schemaNamePrefix: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListSchemasResponse {
        let input = ListSchemasRequest(
            limit: limit, 
            nextToken: nextToken, 
            registryName: registryName, 
            schemaNamePrefix: schemaNamePrefix
        )
        return try await self.listSchemas(input, logger: logger)
    }

    /// Get tags for resource.
    @Sendable
    @inlinable
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListTagsForResourceResponse {
        try await self.client.execute(
            operation: "ListTagsForResource", 
            path: "/tags/{ResourceArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Get tags for resource.
    ///
    /// Parameters:
    ///   - resourceArn: The ARN of the resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func listTagsForResource(
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListTagsForResourceResponse {
        let input = ListTagsForResourceRequest(
            resourceArn: resourceArn
        )
        return try await self.listTagsForResource(input, logger: logger)
    }

    /// Put code binding URI
    @Sendable
    @inlinable
    public func putCodeBinding(_ input: PutCodeBindingRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> PutCodeBindingResponse {
        try await self.client.execute(
            operation: "PutCodeBinding", 
            path: "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}/language/{Language}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Put code binding URI
    ///
    /// Parameters:
    ///   - language: The language of the code binding.
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - schemaVersion: Specifying this limits the results to only this schema version.
    ///   - logger: Logger use during operation
    @inlinable
    public func putCodeBinding(
        language: String,
        registryName: String,
        schemaName: String,
        schemaVersion: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> PutCodeBindingResponse {
        let input = PutCodeBindingRequest(
            language: language, 
            registryName: registryName, 
            schemaName: schemaName, 
            schemaVersion: schemaVersion
        )
        return try await self.putCodeBinding(input, logger: logger)
    }

    /// The name of the policy.
    @Sendable
    @inlinable
    public func putResourcePolicy(_ input: PutResourcePolicyRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> PutResourcePolicyResponse {
        try await self.client.execute(
            operation: "PutResourcePolicy", 
            path: "/v1/policy", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// The name of the policy.
    ///
    /// Parameters:
    ///   - policy: The resource-based policy.
    ///   - registryName: The name of the registry.
    ///   - revisionId: The revision ID of the policy.
    ///   - logger: Logger use during operation
    @inlinable
    public func putResourcePolicy(
        policy: String? = nil,
        registryName: String? = nil,
        revisionId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> PutResourcePolicyResponse {
        let input = PutResourcePolicyRequest(
            policy: policy, 
            registryName: registryName, 
            revisionId: revisionId
        )
        return try await self.putResourcePolicy(input, logger: logger)
    }

    /// Search the schemas
    @Sendable
    @inlinable
    public func searchSchemas(_ input: SearchSchemasRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> SearchSchemasResponse {
        try await self.client.execute(
            operation: "SearchSchemas", 
            path: "/v1/registries/name/{RegistryName}/schemas/search", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Search the schemas
    ///
    /// Parameters:
    ///   - keywords: Specifying this limits the results to only schemas that include the provided keywords.
    ///   - limit: 
    ///   - nextToken: The token that specifies the next page of results to return. To request the first page, leave NextToken empty. The token will expire in 24 hours, and cannot be shared with other accounts.
    ///   - registryName: The name of the registry.
    ///   - logger: Logger use during operation
    @inlinable
    public func searchSchemas(
        keywords: String? = nil,
        limit: Int? = nil,
        nextToken: String? = nil,
        registryName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> SearchSchemasResponse {
        let input = SearchSchemasRequest(
            keywords: keywords, 
            limit: limit, 
            nextToken: nextToken, 
            registryName: registryName
        )
        return try await self.searchSchemas(input, logger: logger)
    }

    /// Starts the discoverer
    @Sendable
    @inlinable
    public func startDiscoverer(_ input: StartDiscovererRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> StartDiscovererResponse {
        try await self.client.execute(
            operation: "StartDiscoverer", 
            path: "/v1/discoverers/id/{DiscovererId}/start", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Starts the discoverer
    ///
    /// Parameters:
    ///   - discovererId: The ID of the discoverer.
    ///   - logger: Logger use during operation
    @inlinable
    public func startDiscoverer(
        discovererId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> StartDiscovererResponse {
        let input = StartDiscovererRequest(
            discovererId: discovererId
        )
        return try await self.startDiscoverer(input, logger: logger)
    }

    /// Stops the discoverer
    @Sendable
    @inlinable
    public func stopDiscoverer(_ input: StopDiscovererRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> StopDiscovererResponse {
        try await self.client.execute(
            operation: "StopDiscoverer", 
            path: "/v1/discoverers/id/{DiscovererId}/stop", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Stops the discoverer
    ///
    /// Parameters:
    ///   - discovererId: The ID of the discoverer.
    ///   - logger: Logger use during operation
    @inlinable
    public func stopDiscoverer(
        discovererId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> StopDiscovererResponse {
        let input = StopDiscovererRequest(
            discovererId: discovererId
        )
        return try await self.stopDiscoverer(input, logger: logger)
    }

    /// Add tags to a resource.
    @Sendable
    @inlinable
    public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "TagResource", 
            path: "/tags/{ResourceArn}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Add tags to a resource.
    ///
    /// Parameters:
    ///   - resourceArn: The ARN of the resource.
    ///   - tags: Tags associated with the resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func tagResource(
        resourceArn: String,
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = TagResourceRequest(
            resourceArn: resourceArn, 
            tags: tags
        )
        return try await self.tagResource(input, logger: logger)
    }

    /// Removes tags from a resource.
    @Sendable
    @inlinable
    public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "UntagResource", 
            path: "/tags/{ResourceArn}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Removes tags from a resource.
    ///
    /// Parameters:
    ///   - resourceArn: The ARN of the resource.
    ///   - tagKeys: Keys of key-value pairs.
    ///   - logger: Logger use during operation
    @inlinable
    public func untagResource(
        resourceArn: String,
        tagKeys: [String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = UntagResourceRequest(
            resourceArn: resourceArn, 
            tagKeys: tagKeys
        )
        return try await self.untagResource(input, logger: logger)
    }

    /// Updates the discoverer
    @Sendable
    @inlinable
    public func updateDiscoverer(_ input: UpdateDiscovererRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateDiscovererResponse {
        try await self.client.execute(
            operation: "UpdateDiscoverer", 
            path: "/v1/discoverers/id/{DiscovererId}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates the discoverer
    ///
    /// Parameters:
    ///   - crossAccount: Support discovery of schemas in events sent to the bus from another account. (default: true)
    ///   - description: The description of the discoverer to update.
    ///   - discovererId: The ID of the discoverer.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateDiscoverer(
        crossAccount: Bool? = nil,
        description: String? = nil,
        discovererId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateDiscovererResponse {
        let input = UpdateDiscovererRequest(
            crossAccount: crossAccount, 
            description: description, 
            discovererId: discovererId
        )
        return try await self.updateDiscoverer(input, logger: logger)
    }

    /// Updates a registry.
    @Sendable
    @inlinable
    public func updateRegistry(_ input: UpdateRegistryRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateRegistryResponse {
        try await self.client.execute(
            operation: "UpdateRegistry", 
            path: "/v1/registries/name/{RegistryName}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates a registry.
    ///
    /// Parameters:
    ///   - description: The description of the registry to update.
    ///   - registryName: The name of the registry.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateRegistry(
        description: String? = nil,
        registryName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateRegistryResponse {
        let input = UpdateRegistryRequest(
            description: description, 
            registryName: registryName
        )
        return try await self.updateRegistry(input, logger: logger)
    }

    /// Updates the schema definition Inactive schemas will be deleted after two years.
    @Sendable
    @inlinable
    public func updateSchema(_ input: UpdateSchemaRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateSchemaResponse {
        try await self.client.execute(
            operation: "UpdateSchema", 
            path: "/v1/registries/name/{RegistryName}/schemas/name/{SchemaName}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates the schema definition Inactive schemas will be deleted after two years.
    ///
    /// Parameters:
    ///   - clientTokenId: The ID of the client token.
    ///   - content: The source of the schema definition.
    ///   - description: The description of the schema.
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - type: The schema type for the events schema.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateSchema(
        clientTokenId: String? = UpdateSchemaRequest.idempotencyToken(),
        content: String? = nil,
        description: String? = nil,
        registryName: String,
        schemaName: String,
        type: `Type`? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateSchemaResponse {
        let input = UpdateSchemaRequest(
            clientTokenId: clientTokenId, 
            content: content, 
            description: description, 
            registryName: registryName, 
            schemaName: schemaName, 
            type: type
        )
        return try await self.updateSchema(input, logger: logger)
    }
}

extension Schemas {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: Schemas, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension Schemas {
    /// Return PaginatorSequence for operation ``listDiscoverers(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listDiscoverersPaginator(
        _ input: ListDiscoverersRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListDiscoverersRequest, ListDiscoverersResponse> {
        return .init(
            input: input,
            command: self.listDiscoverers,
            inputKey: \ListDiscoverersRequest.nextToken,
            outputKey: \ListDiscoverersResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listDiscoverers(_:logger:)``.
    ///
    /// - Parameters:
    ///   - discovererIdPrefix: Specifying this limits the results to only those discoverer IDs that start with the specified prefix.
    ///   - limit: 
    ///   - sourceArnPrefix: Specifying this limits the results to only those ARNs that start with the specified prefix.
    ///   - logger: Logger used for logging
    @inlinable
    public func listDiscoverersPaginator(
        discovererIdPrefix: String? = nil,
        limit: Int? = nil,
        sourceArnPrefix: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListDiscoverersRequest, ListDiscoverersResponse> {
        let input = ListDiscoverersRequest(
            discovererIdPrefix: discovererIdPrefix, 
            limit: limit, 
            sourceArnPrefix: sourceArnPrefix
        )
        return self.listDiscoverersPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listRegistries(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listRegistriesPaginator(
        _ input: ListRegistriesRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListRegistriesRequest, ListRegistriesResponse> {
        return .init(
            input: input,
            command: self.listRegistries,
            inputKey: \ListRegistriesRequest.nextToken,
            outputKey: \ListRegistriesResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listRegistries(_:logger:)``.
    ///
    /// - Parameters:
    ///   - limit: 
    ///   - registryNamePrefix: Specifying this limits the results to only those registry names that start with the specified prefix.
    ///   - scope: Can be set to Local or AWS to limit responses to your custom registries, or the ones provided by AWS.
    ///   - logger: Logger used for logging
    @inlinable
    public func listRegistriesPaginator(
        limit: Int? = nil,
        registryNamePrefix: String? = nil,
        scope: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListRegistriesRequest, ListRegistriesResponse> {
        let input = ListRegistriesRequest(
            limit: limit, 
            registryNamePrefix: registryNamePrefix, 
            scope: scope
        )
        return self.listRegistriesPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listSchemaVersions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listSchemaVersionsPaginator(
        _ input: ListSchemaVersionsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListSchemaVersionsRequest, ListSchemaVersionsResponse> {
        return .init(
            input: input,
            command: self.listSchemaVersions,
            inputKey: \ListSchemaVersionsRequest.nextToken,
            outputKey: \ListSchemaVersionsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listSchemaVersions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - limit: 
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - logger: Logger used for logging
    @inlinable
    public func listSchemaVersionsPaginator(
        limit: Int? = nil,
        registryName: String,
        schemaName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListSchemaVersionsRequest, ListSchemaVersionsResponse> {
        let input = ListSchemaVersionsRequest(
            limit: limit, 
            registryName: registryName, 
            schemaName: schemaName
        )
        return self.listSchemaVersionsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listSchemas(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listSchemasPaginator(
        _ input: ListSchemasRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListSchemasRequest, ListSchemasResponse> {
        return .init(
            input: input,
            command: self.listSchemas,
            inputKey: \ListSchemasRequest.nextToken,
            outputKey: \ListSchemasResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listSchemas(_:logger:)``.
    ///
    /// - Parameters:
    ///   - limit: 
    ///   - registryName: The name of the registry.
    ///   - schemaNamePrefix: Specifying this limits the results to only those schema names that start with the specified prefix.
    ///   - logger: Logger used for logging
    @inlinable
    public func listSchemasPaginator(
        limit: Int? = nil,
        registryName: String,
        schemaNamePrefix: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListSchemasRequest, ListSchemasResponse> {
        let input = ListSchemasRequest(
            limit: limit, 
            registryName: registryName, 
            schemaNamePrefix: schemaNamePrefix
        )
        return self.listSchemasPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``searchSchemas(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func searchSchemasPaginator(
        _ input: SearchSchemasRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<SearchSchemasRequest, SearchSchemasResponse> {
        return .init(
            input: input,
            command: self.searchSchemas,
            inputKey: \SearchSchemasRequest.nextToken,
            outputKey: \SearchSchemasResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``searchSchemas(_:logger:)``.
    ///
    /// - Parameters:
    ///   - keywords: Specifying this limits the results to only schemas that include the provided keywords.
    ///   - limit: 
    ///   - registryName: The name of the registry.
    ///   - logger: Logger used for logging
    @inlinable
    public func searchSchemasPaginator(
        keywords: String? = nil,
        limit: Int? = nil,
        registryName: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<SearchSchemasRequest, SearchSchemasResponse> {
        let input = SearchSchemasRequest(
            keywords: keywords, 
            limit: limit, 
            registryName: registryName
        )
        return self.searchSchemasPaginator(input, logger: logger)
    }
}

extension Schemas.ListDiscoverersRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> Schemas.ListDiscoverersRequest {
        return .init(
            discovererIdPrefix: self.discovererIdPrefix,
            limit: self.limit,
            nextToken: token,
            sourceArnPrefix: self.sourceArnPrefix
        )
    }
}

extension Schemas.ListRegistriesRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> Schemas.ListRegistriesRequest {
        return .init(
            limit: self.limit,
            nextToken: token,
            registryNamePrefix: self.registryNamePrefix,
            scope: self.scope
        )
    }
}

extension Schemas.ListSchemaVersionsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> Schemas.ListSchemaVersionsRequest {
        return .init(
            limit: self.limit,
            nextToken: token,
            registryName: self.registryName,
            schemaName: self.schemaName
        )
    }
}

extension Schemas.ListSchemasRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> Schemas.ListSchemasRequest {
        return .init(
            limit: self.limit,
            nextToken: token,
            registryName: self.registryName,
            schemaNamePrefix: self.schemaNamePrefix
        )
    }
}

extension Schemas.SearchSchemasRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> Schemas.SearchSchemasRequest {
        return .init(
            keywords: self.keywords,
            limit: self.limit,
            nextToken: token,
            registryName: self.registryName
        )
    }
}

// MARK: Waiters

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension Schemas {
    /// Waiter for operation ``describeCodeBinding(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func waitUntilCodeBindingExists(
        _ input: DescribeCodeBindingRequest,
        maxWaitTime: TimeAmount? = nil,
        logger: Logger = AWSClient.loggingDisabled
    ) async throws {
        let waiter = AWSClient.Waiter<DescribeCodeBindingRequest, _>(
            acceptors: [
                .init(state: .success, matcher: try! JMESPathMatcher("status", expected: "CREATE_COMPLETE")),
                .init(state: .retry, matcher: try! JMESPathMatcher("status", expected: "CREATE_IN_PROGRESS")),
                .init(state: .failure, matcher: try! JMESPathMatcher("status", expected: "CREATE_FAILED")),
                .init(state: .failure, matcher: AWSErrorCodeMatcher("NotFoundException")),
            ],
            command: self.describeCodeBinding
        )
        return try await self.client.waitUntil(input, waiter: waiter, maxWaitTime: maxWaitTime, logger: logger)
    }
    /// Waiter for operation ``describeCodeBinding(_:logger:)``.
    ///
    /// - Parameters:
    ///   - language: The language of the code binding.
    ///   - registryName: The name of the registry.
    ///   - schemaName: The name of the schema.
    ///   - schemaVersion: Specifying this limits the results to only this schema version.
    ///   - logger: Logger used for logging
    @inlinable
    public func waitUntilCodeBindingExists(
        language: String,
        registryName: String,
        schemaName: String,
        schemaVersion: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DescribeCodeBindingRequest(
            language: language, 
            registryName: registryName, 
            schemaName: schemaName, 
            schemaVersion: schemaVersion
        )
        try await self.waitUntilCodeBindingExists(input, logger: logger)
    }
}
